package xiao_jin.fantastic_journey.generator;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.minecraft.block.Blocks;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import xiao_jin.fantastic_journey.core.init.ModBlocks;
import xiao_jin.fantastic_journey.core.init.ModTags;

import java.util.concurrent.CompletableFuture;

public final class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
    public ModBlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
        super(output, registriesFuture);
    }

    @Override
    protected void configure(RegistryWrapper.WrapperLookup arg) {

        getOrCreateTagBuilder(ModTags.BLOCK_SHALLOW_ORE)// 浅层矿石
                .add(Blocks.GOLD_ORE)
                .add(Blocks.IRON_ORE)
                .add(Blocks.DIAMOND_ORE)
                .add(Blocks.REDSTONE_ORE)
                .add(Blocks.LAPIS_ORE)
                .add(Blocks.COAL_ORE)
                .add(Blocks.EMERALD_ORE)
                .add(Blocks.COPPER_ORE)
                .add(Blocks.RAW_COPPER_BLOCK)
                .add(Blocks.RAW_GOLD_BLOCK)
                .add(Blocks.RAW_IRON_BLOCK);

        getOrCreateTagBuilder(BlockTags.WALLS)
                .add(ModBlocks.DEEP_RELICTECH_STONE_WALL)
                .add(ModBlocks.RELICTECH_STONE_WALL)
                .add(ModBlocks.RELICTECH_CRACK_STONE_WALL)
                .add(ModBlocks.RELICTECH_STONE_BRICKS_WALL)
                .add(ModBlocks.RELICTECH_CRACK_STONE_BRICKS_WALL);

        getOrCreateTagBuilder(ModTags.DEEP_BLOCK_RELICTECH)// 深层遗迹
                .add(ModBlocks.DEEP_RELICTECH_DIAMOND_ORE)
                .add(ModBlocks.DEEP_RELICTECH_COPPER_ORE)
                .add(ModBlocks.DEEP_RELICTECH_EMERALD_ORE)
                .add(ModBlocks.DEEP_RELICTECH_GOLD_ORE)
                .add(ModBlocks.DEEP_RELICTECH_IRON_ORE)
                .add(ModBlocks.DEEP_RELICTECH_REDSTONE_ORE)
                .add(ModBlocks.DEEP_RELICTECH_LAPIS_ORE)
                .add(ModBlocks.DEEP_RELICTECH_STONE)
                .add(ModBlocks.DEEP_RELICTECH_STONE_SLAB)
                .add(ModBlocks.DEEP_RELICTECH_STONE_STAIRS)
                .add(ModBlocks.DEEP_RELICTECH_STONE_WALL);

        getOrCreateTagBuilder(ModTags.BLOCK_RELICTECH)// 遗迹
                .add(ModBlocks.RELICTECH_BASE_STONE)
                .add(ModBlocks.RELICTECH_TABLE)
                .add(ModBlocks.RELICTECH_QUARTET_LOCK)
                .add(ModBlocks.RELICTECH_STONE)
                .add(ModBlocks.DEEP_RELICTECH_STONE)
                .add(ModBlocks.RELICTECH_STONE_BRICKS)
                .add(ModBlocks.RELICTECH_STONE_SLAB)
                .add(ModBlocks.DEEP_RELICTECH_STONE_SLAB)
                .add(ModBlocks.RELICTECH_STONE_STAIRS)
                .add(ModBlocks.DEEP_RELICTECH_STONE_STAIRS)
                .add(ModBlocks.RELICTECH_STONE_WALL)
                .add(ModBlocks.DEEP_RELICTECH_STONE_WALL)
                .add(ModBlocks.RELICTECH_STONE_BRICKS_SLAB)
                .add(ModBlocks.RELICTECH_STONE_BRICKS_STAIRS)
                .add(ModBlocks.RELICTECH_STONE_BRICKS_WALL)
                .add(ModBlocks.RELICTECH_CRACK_STONE)
                .add(ModBlocks.RELICTECH_CRACK_STONE_BRICKS)
                .add(ModBlocks.RELICTECH_CRACK_STONE_SLAB)
                .add(ModBlocks.RELICTECH_CRACK_STONE_STAIRS)
                .add(ModBlocks.RELICTECH_CRACK_STONE_WALL)
                .add(ModBlocks.RELICTECH_CRACK_STONE_BRICKS_SLAB)
                .add(ModBlocks.RELICTECH_CRACK_STONE_BRICKS_STAIRS)
                .add(ModBlocks.RELICTECH_CRACK_STONE_BRICKS_WALL)
                .add(ModBlocks.RELICTECH_DIAMOND_ORE)
                .add(ModBlocks.RELICTECH_EMERALD_ORE)
                .add(ModBlocks.RELICTECH_GOLD_ORE)
                .add(ModBlocks.RELICTECH_IRON_ORE)
                .add(ModBlocks.RELICTECH_REDSTONE_ORE)
                .add(ModBlocks.RELICTECH_LAPIS_ORE)
                .add(ModBlocks.RELICTECH_COPPER_ORE)
        ;
        // 稿子等级标签
        getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE)// 镐
                .add(ModBlocks.RELICTECH_BASE_STONE)
                .add(ModBlocks.RELICTECH_TABLE)
                .add(ModBlocks.RELICTECH_QUARTET_LOCK)
                .add(ModBlocks.RELICTECH_STONE)
                .add(ModBlocks.DEEP_RELICTECH_STONE)
                .add(ModBlocks.RELICTECH_STONE_SLAB)
                .add(ModBlocks.DEEP_RELICTECH_STONE_SLAB)
                .add(ModBlocks.RELICTECH_STONE_STAIRS)
                .add(ModBlocks.DEEP_RELICTECH_STONE_STAIRS)
                .add(ModBlocks.RELICTECH_STONE_WALL)
                .add(ModBlocks.DEEP_RELICTECH_STONE_WALL)
                .add(ModBlocks.RELICTECH_STONE_BRICKS)
                .add(ModBlocks.RELICTECH_STONE_BRICKS_SLAB)
                .add(ModBlocks.RELICTECH_STONE_BRICKS_STAIRS)
                .add(ModBlocks.RELICTECH_STONE_BRICKS_WALL)
                .add(ModBlocks.RELICTECH_CRACK_STONE)
                .add(ModBlocks.RELICTECH_CRACK_STONE_SLAB)
                .add(ModBlocks.RELICTECH_CRACK_STONE_STAIRS)
                .add(ModBlocks.RELICTECH_CRACK_STONE_WALL)
                .add(ModBlocks.RELICTECH_CRACK_STONE_BRICKS)
                .add(ModBlocks.RELICTECH_CRACK_STONE_BRICKS_SLAB)
                .add(ModBlocks.RELICTECH_CRACK_STONE_BRICKS_STAIRS)
                .add(ModBlocks.RELICTECH_CRACK_STONE_BRICKS_WALL)
                .add(ModBlocks.DEEP_RELICTECH_STONE)
                .add(ModBlocks.DEEP_RELICTECH_STONE_SLAB)
                .add(ModBlocks.DEEP_RELICTECH_STONE_STAIRS)
                .add(ModBlocks.DEEP_RELICTECH_STONE_WALL)
                .add(ModBlocks.RELICTECH_DIAMOND_ORE)
                .add(ModBlocks.DEEP_RELICTECH_DIAMOND_ORE)
                .add(ModBlocks.RELICTECH_EMERALD_ORE)
                .add(ModBlocks.DEEP_RELICTECH_EMERALD_ORE)
                .add(ModBlocks.RELICTECH_GOLD_ORE)
                .add(ModBlocks.DEEP_RELICTECH_GOLD_ORE)
                .add(ModBlocks.RELICTECH_IRON_ORE)
                .add(ModBlocks.DEEP_RELICTECH_IRON_ORE)
                .add(ModBlocks.RELICTECH_REDSTONE_ORE)
                .add(ModBlocks.DEEP_RELICTECH_REDSTONE_ORE)
                .add(ModBlocks.RELICTECH_LAPIS_ORE)
                .add(ModBlocks.DEEP_RELICTECH_LAPIS_ORE)
                .add(ModBlocks.RELICTECH_COPPER_ORE)
                .add(ModBlocks.DEEP_RELICTECH_COPPER_ORE)
                .add(ModBlocks.EXPLOSIVE_STEEL_BLOCK);

        getOrCreateTagBuilder(BlockTags.HOE_MINEABLE);// 锄
        getOrCreateTagBuilder(BlockTags.AXE_MINEABLE);// 斧
        getOrCreateTagBuilder(BlockTags.SHOVEL_MINEABLE)// 锹
                .add(ModBlocks.WASTE_SOIL)
                .add(ModBlocks.SILICIFIED_WASTE_SOIL)
                .add(ModBlocks.CULTIVATED_WASTE_SOIL);

        getOrCreateTagBuilder(BlockTags.NEEDS_DIAMOND_TOOL)// 钻石
        ;

        getOrCreateTagBuilder(BlockTags.NEEDS_IRON_TOOL)// 铁
                .add(ModBlocks.RELICTECH_DIAMOND_ORE)
                .add(ModBlocks.DEEP_RELICTECH_DIAMOND_ORE)
                .add(ModBlocks.RELICTECH_EMERALD_ORE)
                .add(ModBlocks.DEEP_RELICTECH_EMERALD_ORE)
                .add(ModBlocks.RELICTECH_GOLD_ORE)
                .add(ModBlocks.DEEP_RELICTECH_GOLD_ORE)
                .add(ModBlocks.RELICTECH_REDSTONE_ORE)
                .add(ModBlocks.DEEP_RELICTECH_REDSTONE_ORE)
        ;
        getOrCreateTagBuilder(BlockTags.NEEDS_STONE_TOOL)// 石头
                .add(ModBlocks.RELICTECH_IRON_ORE)
                .add(ModBlocks.DEEP_RELICTECH_IRON_ORE)
                .add(ModBlocks.RELICTECH_COPPER_ORE)
                .add(ModBlocks.DEEP_RELICTECH_COPPER_ORE)
                .add(ModBlocks.RELICTECH_LAPIS_ORE)
                .add(ModBlocks.DEEP_RELICTECH_LAPIS_ORE)
                .add(ModBlocks.EXPLOSIVE_STEEL_BLOCK);

        getOrCreateTagBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("fabric", "needs_tool_level_4")));// 下界合金
    }
}
